<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String path = request.getContextPath();
%>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="<%=path %>/css/login.css"  type="text/css" />
<%@ include file="/WEB-INF/jsp/common/common.jsp" %>
<!-- 禁止缓存 -->
<meta http-equiv="pragma" content="no-cache"> 
<meta http-equiv="cache-control" content="no-cache"> 
<meta http-equiv="expires" content="0"> 
<title>燕赵财产保险股份有限公司</title>
<script type="text/javascript">
var lock = false; //防重复提交标识，默认为false，如果第二次重复提交，获取lock为true，将不再执行ajax请求
$(document).ready(function() {
	if(window.parent.iframe!=undefined){
		window.parent.location.href="<%=path%>/showLogin";
	}
		$("#loginBtn").on("click", function(){
			var ucodeval = $("#ucode").val();
			var upwdval = $("#upwd").val();
			if($.trim(ucodeval)==""){
				$("#errdiv").html("请输入用户名");
				return;
			}
			if(upwdval==""){
				$("#errdiv").html("请输入密码");
				return;
			}
			if(lock){return;}
			lock = true;
				$.ajax({
					url: "<%=path%>/checkLogin",
					type: "post",
					dataType: "json",
					cache:false,
					data:{"usercode":ucodeval,"userpwd":upwdval},
					success: function(data) {
						lock = false;
						if(data && data.result == "error"){//错误
							$("#errdiv").html(data.message);
								$("#ucode").val("");
								$("#upwd").val("");
								$("#ucode").focus();
						}else if(data && data.result == "fail"){//错误
							$("#errdiv").html("系统异常，请联系管理员");
							$("#ucode").val("");
							$("#upwd").val("");
							$("#ucode").focus();
					}else{
								self.location.href="<%=path%>/showIndex";
							}
					},
					error : function() {
						$.message('error','系统出现异常！请联系管理员！');
						lock = false;
					}
				});
			});
});

var SubmitOrHidden = function(evt){
    evt = window.event || evt;
    if(evt.keyCode==13){//如果取到的键值是回车，则执行校验和提交动作
		var ucodeval = $("#ucode").val();
		var upwdval = $("#upwd").val();
		if($.trim(ucodeval)==""){
			$("#errdiv").html("请输入用户名");
			return;
		}
		if(upwdval==""){
			$("#errdiv").html("请输入密码");
			return;
		}
		if(lock){return;}
		lock = true;
			$.ajax({
				url: "<%=path%>/checkLogin",
				type: "post",
				dataType: "json",
				data:{"usercode":ucodeval,"userpwd":upwdval},
				success: function(data) {
					if(data && data.result == "fail"){//错误
						$("#errdiv").html(data.message);
						$("#ucode").val("");
						$("#upwd").val("");
						$("#ucode").focus();
					}
					else
					{
						self.location.href="<%=path%>/showIndex";
					}
					lock = false;
				},
				error : function() {
					$.message('error','系统出现异常！请联系管理员！');
					lock = false;	
				}
			});
     }else{
        return;
    }
                 
}
window.document.onkeydown=SubmitOrHidden;//当按下Enter键时执行函数
</script>
</head>

<body onload="vMiddle();">
<div class="top"> 
<img src="<%=path %>/images/fullLogo_bak.png" style="width:100%;height:100%;"/>
<!--      <ul> -->
<%--      <li><img src="<%=path %>/images/fullLogo.png" style="width:100%;height:100%;"/></li> --%>
<%--         <li><img src="<%=path %>/images/loginImgs/zhonghua_logo.jpg" /></li> --%>
<%--         <li style=" float:right; margin-right:30px"><img src="<%=path %>/images/loginImgs/top_4.jpg" /></li> --%>
     </ul> 
</div>
<div class="content">
  <ul>
    <div id="main">
         <div class="main_left">
              
         </div>
         <div class="main_right">
              <table class="table_right" cellpadding="0" cellspacing="0"> 
                <tr>
                   <th colspan="2">登录合作伙伴交易系统</th>
                </tr>
				<tr>
                   <th colspan="2"><div style="border:0px solid blue;width:200px;height:23px;color:red;font-weight:lighter;font-size:12px;"  id="errdiv">${errorMsg}</div></th>
                </tr>	
                <tr>
                   <td width="80">用户名：</td>
                   <td><input class="input_1" name="usercode" id="ucode" type="text" /></td>
                </tr>
                <tr>
                   <td>密码：</td>
                   <td><input class="input_2" name="userpwd" id="upwd" type="password" /></td>
                </tr>
                <tr>
                   <td>&nbsp;</td>
                   <td>
                       <input class="button_1" value="登&nbsp;录" name="input" type="button" id="loginBtn" style="cursor:pointer"/> 
                   </td>
                </tr>
                </table>         
         </div>
    </div>
  </ul>  
</div>
<div class="footer" >
<div class="s">
         <p>Copyright  <font style="font-size:19px;line-height:20px;vertical-align: middle;">©</font> 2023&nbsp;燕赵财产保险股份有限公司</p>
     </div>
     <div class="x"><ul></ul></div>
</div>
</body>
</html>
 <script type="text/javascript">
 function vMiddle(){
    var middleDiv=document.getElementById("main");
    var divHeight=middleDiv.offsetHeight;
    var bodyHeight=document.body.offsetHeight ;
    if(bodyHeight>divHeight)
      middleDiv.style.marginTop=-divHeight/2+"px";
   else{
      middleDiv.style.marginTop=0;
      middleDiv.style.top=0;
    }
//    switchBrowser();
}
 
 function switchBrowser(){
	 var Sys = {};
	 var ua = navigator.userAgent.toLowerCase();
	 var s;
	 (s = ua.match(/msie ([\d.]+)/)) ? Sys.ie = s[1] :
	 (s = ua.match(/firefox\/([\d.]+)/)) ? Sys.firefox = s[1] :
	 (s = ua.match(/chrome\/([\d.]+)/)) ? Sys.chrome = s[1] :
	 (s = ua.match(/opera.([\d.]+)/)) ? Sys.opera = s[1] :
	 (s = ua.match(/version\/([\d.]+).*safari/)) ? Sys.safari = s[1] : 0;
	
	 if (Sys.ie){
//		 $('.top').css('height','20%');
		 $('.top').css('width','100%');
	 }
	 if (Sys.firefox){
//		 $('.top').css('width','100%');
		 $('.top').css('height','19%');
	 }
	 if (Sys.chrome){
//		 $('.top').css('width','100%');
		 $('.top').css('height','18%');
	 }
	 
	 $(window).resize(function(){
//		 $('.top').css('width','100%');
	 });
 }
 
</script>